import { Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn, OneToMany, PrimaryColumn, BaseEntity } from 'typeorm';
import { UserEntity } from '../../user/entities/user.entity';
import { WaybillEntity } from 'src/modules/waybill/entities/waybill.entity';
import { DriverEntity } from 'src/modules/driver/entities/driver.entity';

@Entity({ name: 'sys_enterprise', comment: '企业表' })
export class EnterpriseEntity extends BaseEntity {
  @PrimaryColumn({ name: 'enterprise_id', type: 'char', comment: '企业id' })
  enterpriseId: string;

  @Column({ name: 'enterprise_name', type: 'varchar', length: 255, comment: '企业名称' })
  enterpriseName: string;

  @Column({ name: 'enterprise_address', type: 'varchar', length: 255, comment: '企业地址' })
  enterpriseAddress: string;

  @Column({ name: 'enterprise_charter', type: 'varchar', length: 255, nullable: true, comment: '营业执照' })
  enterpriseCharter: string | null;

  @Column({ name: 'enterprise_logo', type: 'varchar', length: 255, nullable: true, comment: '企业logo' })
  enterpriseLogo: string | null;

  @Column({ name: 'expire_time', type: 'datetime', nullable: true, comment: '企业服务到期时间' })
  expireTime: Date | null;

  @OneToMany(() => WaybillEntity, (waybill) => waybill.enterprise)
  waybills: WaybillEntity[];
}
